#ifndef SESSIONPRECENCEMANAGERTEST_HPP
#define SESSIONPRECENCEMANAGERTEST_HPP

#include <gtest/gtest.h>
#include "SessionPresenceManager.h"

TEST(SessionPresenceSerialization, ShoudWorkAsExpected)
{
  SessionPresence one("1","2","3");
  SessionPresence two("2","2","4");
  SessionPresenceManager manager;

  manager.insert(one);
  manager.insert(two);

  ASSERT_EQ(2,manager.size());

  manager.serialize("./session_presence.csv");
  manager.deserialize("./session_presence.csv");

  ASSERT_EQ(2,manager.size());

  const SessionPresence *gotOne = manager.sessionPresenceById(one.id());
  const SessionPresence *gotTwo = manager.sessionPresenceById(two.id());

  ASSERT_TRUE(gotOne != 0);
  ASSERT_TRUE(gotTwo != 0);
  ASSERT_EQ(one, *gotOne);
  ASSERT_EQ(two, *gotTwo);

}

#endif // SESSIONPRECENCEMANAGERTEST_HPP